import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location) {
  return originalPush.call(this, location).catch(err => { })
};
Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/login"
  },
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/order',
    name: 'Order',
    component: () => import(/* webpackChunkName: "order" */ '../views/Order.vue'),
    children: [
      {
        path: '/order/All',
        name: 'OrderAll',
        component: () => import(/* webpackChunkName: "order" */ '../components/OrderAll.vue'),
      },
      // 待发货
      {
        path: '/order/delivered',
        name: 'OrderDelivered',
        component: () => import(/* webpackChunkName: "order" */ '../components/OrderDelivered.vue'),
      },
      {
        path: '/order/receiving',
        name: 'OrderReceiving',
        component: () => import(/* webpackChunkName: "order" */ '../components/OrderReceiving.vue'),
      },
      {
        path: '/order/evaluate',
        name: 'OrderEvaluate',
        component: () => import(/* webpackChunkName: "order" */ '../components/OrderEvaluate.vue'),
      },
    ]
  },
  // 确认发货
  {
    path: '/order/confirmdelivery',
    name: 'ConfirmDelivery',
    component: () => import(/* webpackChunkName: "about" */ '../views/ConfirmDelivery.vue')
  },
  {
    path: '/message',
    name: 'Message',
    component: () => import(/* webpackChunkName: "message" */ '../views/Message.vue'),
  },
  {
    path: '/message/details',
    name: 'MessageDetails',
    component: () => import(/* webpackChunkName: "about" */ '../views/MessageDetails.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue'),
  },
  {
    path: '/user',
    name: 'User',
    component: () => import(/* webpackChunkName: "user" */ '../views/User.vue'),
  },

  {
    path: '/expressbill',
    name: 'ExpressBill',
    component: () => import(/* webpackChunkName: "user" */ '../views/ExpressBill.vue'),
  },
  {
    path: '/evaluation',
    name: 'Evaluation',
    component: () => import(/* webpackChunkName: "user" */ '../views/Evaluation.vue'),
  },
  // 物流单评价

  // 客户列表

  {
    path: '/cust',
    name: 'Cust',
    component: () => import(/* webpackChunkName: "cust" */ '../views/Cust.vue'),
  },
  // 客户详情
  {
    path: '/userdetails',
    name: 'UserDetails',
    component: () => import(/* webpackChunkName: "userdetails" */ '../views/UserDetails.vue'),
  },

  {
    path: '/customerdetails',
    name: 'CustomerDetails',
    component: () => import(/* webpackChunkName: "userdetails" */ '../components/CustomerDetails.vue'),
  },
  // 客户基本信息编辑
  {
    path: '/custedit',
    name: 'CustEdit',
    component: () => import(/* webpackChunkName: "custedit" */ '../components/CustEdit.vue'),
  },
  // 选择客户

  {
    path: '/choicecust',
    name: 'ChoiceCust',
    component: () => import(/* webpackChunkName: "choicecust" */ '../views/ChoiceCust.vue'),
  },
  // 客户关怀
  {
    path: '/visit',
    name: 'Visit',
    component: () => import(/* webpackChunkName: "custedit" */ '../views/Visit.vue'),
  },
  // 新增拜访
  {
    path: '/newaddvisit',
    name: 'NewAddVisit',
    component: () => import(/* webpackChunkName: "custedit" */ '../views/NewAddVisit.vue'),
  },
  // 拜访详情页
  {
    path: '/visitmessage',
    name: 'VisitMessage',
    component: () => import(/* webpackChunkName: "custedit" */ '../views/VisitMessage.vue'),
  },

  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
